package com.test.designpattern.chainOfResponsibility.demo1;

/**
 * 公共抽象类，子类需要集成该类
 * 为子类提供公共属性和模板方法
 */
public abstract class AbstractHandler implements IAuditHandler {

    protected IAuditHandler nextHandler;

    @Override
    public void setNextHandler(IAuditHandler nextHandler){
        this.nextHandler = nextHandler;
    }

    //所有子类都有这个方法
    public void process(Object o) {
        if (nextHandler != null) {
            nextHandler.handler(o);
        } else {
            System.out.println("责任链执行结束...");
        }
    }

}
